<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/common.jsp"%>
<title>外部商品新增</title>
</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form" action="" method="post">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>外部ID：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.itemId}" placeholder="" id="itemId" name="itemId" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>属性ID：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.skuId}" id="skuId" name="skuId">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>名称：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.name}" placeholder="" id="name" name="name" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>属性名称：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.skuName}" placeholder="" id="skuName" name="skuName" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>链接：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.url}" placeholder="" id="url" name="url" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>供应链接：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.supplyUrl}" placeholder="" id="supplyUrl" name="supplyUrl" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>成本：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.cost}" placeholder="" id="cost" name="cost" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>粉丝赠送贝币：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.fansJinBi}" placeholder="" id="fansJinBi" name="fansJinBi" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>会员赠送贝币：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.baseVipJinBi}" placeholder="" id="baseVipJinBi" name="baseVipJinBi" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>代理赠送贝币：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.highVipJinBi}" placeholder="" id="highVipJinBi" name="highVipJinBi" required="true">
            </div>
        </div>
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级会员贝币分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.chiefBaseVipJinBi}" placeholder="" id="chiefBaseVipJinBi" name="chiefBaseVipJinBi" required="true">
            </div>
        </div>
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级代理贝币分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.chiefHighVipJinBi}" placeholder="" id="chiefHighVipJinBi" name="chiefHighVipJinBi" required="true">
            </div>
        </div>
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级会员积分分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.chiefBaseVipPoint}" placeholder="" id="chiefBaseVipPoint" name="chiefBaseVipPoint" required="true">
            </div>
        </div>
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级代理积分分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.chiefHighVipPoint}" placeholder="" id="chiefHighVipPoint" name="chiefHighVipPoint" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">备注：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${outProduct.remark}" placeholder="" id="remark" name="remark" >
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-8 col-xs-offset-4 col-sm-offset-3">
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
            </div>
        </div>
    </form>
</article>

<script type="text/javascript">
$(document).ready(function () {
	var id = "${outProduct.id}";
	 $('#form').bind('submit', function () {
		var itemId = $("#itemId").val();
		var skuId = $("#skuId").val();
		var name = $("#name").val();
		var skuName = $("#skuName").val();
		var url = $("#url").val();
		var supplyUrl = $("#supplyUrl").val();
		var cost = $("#cost").val();
		var fansJinBi = $("#fansJinBi").val();
		var baseVipJinBi = $("#baseVipJinBi").val();
		var highVipJinBi = $("#highVipJinBi").val();
		var chiefBaseVipJinBi = $("#chiefBaseVipJinBi").val();
		var chiefHighVipJinBi = $("#chiefHighVipJinBi").val();
		var chiefBaseVipPoint = $("#chiefBaseVipPoint").val();
		var chiefHighVipPoint = $("#chiefHighVipPoint").val();
		var remark = $("#remark").val();

		$.ajax({
			type : 'POST',
			url : ctx + '/productManage/updateOutProduct.do',
			data : {
				id : id,
				itemId : itemId,
				skuId : skuId,
				name : name,
				skuName : skuName,
				url : url,
				supplyUrl : supplyUrl,
				cost : cost,
				fansJinBi : fansJinBi,
				baseVipJinBi : baseVipJinBi,
				highVipJinBi : highVipJinBi,
				chiefBaseVipJinBi : chiefBaseVipJinBi,
				chiefHighVipJinBi : chiefHighVipJinBi,
				chiefBaseVipPoint : chiefBaseVipPoint,
				chiefHighVipPoint : chiefHighVipPoint,
				remark : remark
			},
			dataType : 'json',
			timeout : 30000,
			context : $('body'),
			success : function(data) {
				if (data.code == "ok") {
                   layer.msg("保存成功!", {icon: 6, time: 1000}, function () {
                   	layer_close();
                   });
				} else {
					 layer.msg(data.msg, {icon: 5, time: 2000});
				}
			},
			error : function(xhr, type) {
				layer.msg('保存失败!', {icon: 5, time: 2000});
			}
		});
		  return false;
	 });
});
</script>
</body>
</html>